package com.iris.live.services.data.repositories;

import com.iris.live.services.data.models.Lsh保险申请附属Model;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.sql.Timestamp;

/**
 * Created by xiO on 2016/11/15.
 */
@Transactional
public interface 保险申请附属Repository extends JpaRepository<Lsh保险申请附属Model, Integer>, JpaSpecificationExecutor<Lsh保险申请附属Model> {


    @Query("select u from Lsh保险申请附属Model u WHERE u.初始报价单号= ?1  ")
    Lsh保险申请附属Model findOnessss(String ids);

    @Modifying
    @Query("update Lsh保险申请附属Model a set a.战败原因=?1,a.状态=?3,a.更新时间=?4,a.更新账号=?5 where a.初始报价单号=?2")
    int updateInsStateAndReasonById(Integer id, String quCode, String sate, Timestamp ts, String userName);

    @Modifying
    @Query("update Lsh保险申请附属Model a set a.状态=?2,a.更新时间=?3,a.更新账号=?4 where a.初始报价单号=?1")
    int updateInsStateById(String quCode, String sate, Timestamp ts, String userName);

    @Modifying
    @Query("update Lsh保险申请附属Model a set a.更新时间=?2,a.更新账号=?3,a.操作人=?3 where a.id=?1")
    int updateInsById(Integer id, Timestamp ts, String userName);
}

